Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add discounts #182

Draft
wants to merge 3 commits into
base: dev
Choose a base branch
from
Draft

Add discounts #182

wants to merge 3 commits into from

Conversation

KwikKill
Copy link
Member

@KwikKill KwikKill commented Nov 25, 2024

Description

Add a way to create a discount for a given user + product.
Discount will then be subtracted from the payment total and marked as used when the payment is successful.

TODO : add documentation

Checklist

  • I have tested the changes locally and they work as expected.
  • I have added tests to cover my changes.
  • I have updated the documentation accordingly.
  • I have assigned the pull request to the appropriate reviewer(s).
  • I have added labels to the pull request, if necessary.

Related Issues

Fix #181

Screenshots

image
image
image

@KwikKill KwikKill added enhancement New feature or request priority:low Low Priority labels Nov 25, 2024
@KwikKill KwikKill requested a review from floflo0 November 25, 2024 22:42
@KwikKill KwikKill self-assigned this Nov 25, 2024
@KwikKill KwikKill requested a review from Copilot December 27, 2024 22:51
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

insalan/payment/models.py Show resolved Hide resolved
@KwikKill KwikKill requested a review from Copilot December 27, 2024 23:10
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

insalan/payment/models.py:442

  • [nitpick] The error message 'Discount already used' could be more user-friendly. Consider changing it to 'This discount has already been used.'
raise DiscountAlreadyUsedError("Discount already used")

insalan/payment/views.py Outdated Show resolved Hide resolved
@KwikKill KwikKill requested a review from Copilot December 27, 2024 23:16
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

insalan/payment/models.py:442

  • Add a test to cover the scenario where a discount is already used and the DiscountAlreadyUsedError is raised.
raise DiscountAlreadyUsedError("Discount already used")

insalan/payment/views.py Outdated Show resolved Hide resolved

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (2)

insalan/payment/models.py:425

  • [nitpick] Consider adding validation for the length and content of the reason field.
reason = models.CharField(max_length=200, verbose_name=_("Motif"))

insalan/payment/views.py:434

  • The comment on line 434 should be aligned with the code block it describes for better readability.
# Check if the discount is applicable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority:low Low Priority
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add payment discount handling
1 participant